<%-- 
    Document   : account
    Created on : 2 mai 2011, 15:07:04
    Author     : simon
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="myTags" uri="/WEB-INF/tlds/tagsutil" %>

<c:set var="view" value="/account" scope="session"/>


<div id="content">

    <c:if test="${addAdress == true}">
        <%-- Affichage du formulaire d'ajout d'adresse --%>
        <%@ include file="addAdressForm.jsp"%>
    </c:if>

    <div style="float: left; width: 100%;">
        <span class="bubble rounded" style="float:right; display: block;"><a href="<c:url value="/logout"/>" title="logout">Logout</a></span>
        <span class="bubble rounded" style="float:right; display: block;"><a href="<c:url value="/addAdress"/>" title="Ajouter une adresse">Ajouter une adresse</a></span>
    </div>   
    
    <div class="rounded white accountInfo shadow">
        <h3>Vos infos :</h3>
        <p>Nom : ${customer.lastName} ${customer.firstName}</p>
        <p>Email : ${customer.email}</p>
        <p>Votre compte : ${customer.account.iban}</p>
        <p>Solde : <myTags:price price='${customer.account.balance}' localString="${language}"></myTags:price></p>    
    </div>

    <div class="rounded white accountInfo shadow">
        <h3>Vos adresses :</h3>
        <table>

            <c:forEach var="adress" items="${customer.adressList}">
                <tr>
                    <td>${adress.street} </td> 
                    <td>${adress.zipcode} </td>
                    <td>${adress.city} </td>
                </tr>
            </c:forEach> 

        </table>
    </div>

    <div class="accountOrder rounded white shadow" >
        <h3>Vos achats :</h3>
        <table>
        <c:forEach var="order" items="${customer.ordersList}">
            
            <tr>
                <td>${order.adress.street}</td>
                <td>${order.adress.zipcode}</td>
                <td>${order.adress.city}</td>
            </tr>
            
            
            <c:forEach var="purchase" items="${order.purchaseList}">
            <tr>
                <td><myTags:price price='${purchase.unitPrice}' localString="${language}"></myTags:price></td>
                <td>${purchase.quantity}</td>
                <td>${purchase.product.name}</td>
            </tr>
            </c:forEach>
            

        </c:forEach>
        </table>
    </div>
</div>